#include "gtest/gtest.h"
#include<string>
#include "ce1.h"
class TextBuddy;
using namespace std;
TextBuddy test;

TEST(SearchTest,words)
{	
	//checking a word which occurs in MULTIPLE sentences
	test.Add("Hello");
	test.Add("Hello World");
	test.Add("This is unit testing");
	test.Add("Hello again");
	test.Add("Hello Kitty");
	string result=test.Search("Hello");
	ASSERT_EQ("Hello Hello World Hello again Hello Kitty",result);

	//checking a word which occurs in a sentence only ONCE
	result=test.Search("World");
	ASSERT_EQ("Hello World",result);

	//checking a word which occurs in NO sentence
	result=test.Search("Error");
	ASSERT_EQ("",result);

	//checking same word of DIFFERENT CASE (Case insensitive checking)
	result=test.Search("HeLlO");
	ASSERT_EQ("Hello Hello World Hello again Hello Kitty",result);


	//checking an empty vector for sentences
	test.Clear();
	result=test.Search("Hello");
	ASSERT_EQ("",result);


}
TEST(SortTest,AlphaSort)
{
	//adding again since cleared in previous TEST
	test.Add("Hello");
	test.Add("Hello World");
	test.Add("This is unit testing");
	test.Add("Hello again");
	test.Add("Hello Kitty");

	//checking normal sorting function
	string result=test.Sort();
	ASSERT_EQ("Hello Hello Kitty Hello World Hello again This is unit testing",result);

	//sorting empty vector and checking
	test.Clear();
	result=test.Sort();
	ASSERT_EQ("",result);

}


void runTest(int argument_count, char** argument_vars)

{

	testing::InitGoogleTest(&argument_count, argument_vars); //initialize GTest

	RUN_ALL_TESTS();

	std::getchar(); //pause the program after all the testing

}




